<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:define name="title">
	<h:outputText value="#{lang.LIST_PROJECT}" />
</ui:define>

<body>
	<ui:composition template="layout.xhtml">
		
		<ui:define name="menuBody">
			<ui:include src="adminMenu.xhtml"></ui:include>
		</ui:define>
		<ui:define name="contentHeader">
			<h:outputText value="#{lang.LIST_COLLABORATOR}" />
		</ui:define>
		<ui:define name="contentBody">
			<h:form id="form">
				<p:dataTable var="project" value="#{projectsBean.projects}"
					paginator="true" rows="10" rowStyleClass="data-grid-content"
					tableStyleClass="data-grid" id="projectTable">
					<p:column style="width:16px">
						<p:rowToggler />
					</p:column>
					<p:column headerText="#{lang.ID}" sortBy="#{project.id}"
						filterBy="#{project.id}">
						<h:outputText value="#{project.id}" />
					</p:column>
					<p:column headerText="#{lang.NAME}" sortBy="#{project.name}"
						filterBy="#{project.name}">
						<h:outputText value="#{project.name}" />
					</p:column>
					<p:column headerText="#{lang.MANAGER}"
						sortBy="#{project.manager.firstName}"
						filterBy="#{project.manager.firstName}">
						<h:outputText value="#{project.manager.firstName}" />
					</p:column>
					<p:column headerText="#{lang.PROJECTMANAGER}"
						sortBy="#{project.projectManager.firstName}"
						filterBy="#{project.projectManager.firstName}">
						<h:outputText value="#{project.projectManager.firstName}" />
					</p:column>
					<p:column headerText=" " style="width:100px">
						<p:button icon="ui-icon-edit" outcome="updateProject.xhtml">
							<f:param name="id" value="#{project.id}" />
						</p:button>
						<p:spacer width="5px"></p:spacer>
						<p:commandButton icon="ui-icon-delete"
							onclick="return confirm('#{lang.CONFIRM_DELETE_PROJECT} ?');"
							update="projectTable"
							action="#{projectsBean.deleteProject(project)}">
						</p:commandButton>
					</p:column>
					<p:rowExpansion>
						<p:dataTable value="#{project.team}" var="col">
							<p:column headerText="#{lang.DAS}" id="das">
								<h:outputText value="#{col.das}" />
							</p:column>
							<p:column headerText="#{lang.LASTNAME}" id="nom">
								<h:outputText value="#{col.lastName}" />

							</p:column>
							<p:column headerText="#{lang.FIRSTNAME}" id="prenom">
								<h:outputText value="#{col.firstName}" />
							</p:column>

						</p:dataTable>
						<p:dataTable value="#{project.tools}" var="tool">
							<p:column headerText="#{lang.NAME}" id="toolName">
								<h:outputText value="#{tool.name}" />
							</p:column>
						</p:dataTable>
					</p:rowExpansion>
				</p:dataTable>

			</h:form>
			<br />
			<br />
		</ui:define>

	</ui:composition>
</body>
</html>